package InterfaceExample;

import java.util.ArrayList;

public class printOperatorlmpl1 implements StudentOperator{

    @Override
    public void printAllInfo(ArrayList<Stu> students) {
        System.out.println("------------全部信息如下------------");
        for (Stu student : students) {
            System.out.println("姓名：" + student.getName() + "，性别："+ student.getSex() + "，成绩：" + student.getScore());
        }
        System.out.println("----------------------------------");
    }

    @Override
    public void printArgScore(ArrayList<Stu> students) {
        double allScore = 0;
        for (Stu student : students) {
            allScore += student.getScore();
        }
        System.out.println("平均分：" + allScore / students.size());
    }
}
